/* $Header: sig_ui.h,v 2.5 02/04/25 13:23:12 przybyls Exp $ */

/***********************************************************************/
/* INCLUDE FILE NAME:  sig_ui.h                                        */
/* ==================                                                  */
/*                                                                     */
/* Author:   Lesley Freed                                              */
/*                                                                     */
/* COMMENT: This file contains all of the typedefs and function        */
/*          prototypes used by the user interface for the signal path. */
/*                                                                     */
/***********************************************************************/

#ifndef SIG_UI_H
#define SIG_UI_H


/*****************************/
/*   IFDEFS                  */
/*****************************/


/*****************************/
/*   SYMBOLIC CONSTANTS      */
/*****************************/

/* Scale factor to convert signal values from the DSP to units of 1pA for the */
/* FID.  Since we will display the signal with one digit past the decimal pt. */
/* the conversion factor will be 240/10 or 24.                                */

#define SIG_DISP_SCALE_FACTOR 24
#define SIG_SCALE_FACTOR      240

#define MIN_ATTN_SETPT 0
#define MAX_ATTN_SETPT 10

#define MIN_RANGE_SETPT 0
#define MAX_RANGE_SETPT 13

/* Define the min and max data rates for parameter checking */

#define MIN_DATA_RATE   RATE_PT1HZ
#define MAX_DATA_RATE   RATE_500HZ

#define RTT_ZERO_ON_VALUE   120000001   /* note: was 0x7fffffff (lmf 5/24/94) */
#define RTT_ZERO_OFF_VALUE  (-1*RTT_ZERO_ON_VALUE)
#define MAX_ZERO_VALUE      120000000
#define MIN_ZERO_VALUE      (-1*MAX_ZERO_VALUE)
#define MAX_DISP_ZERO_VALUE MAX_ZERO_VALUE/SIG_DISP_SCALE_FACTOR
#define MIN_DISP_ZERO_VALUE -1*MAX_DISP_ZERO_VALUE
#define MAX_UNSCALED_ZERO_VALUE MAX_ZERO_VALUE/10
#define MIN_UNSCALED_ZERO_VALUE -1*MAX_UNSCALED_ZERO_VALUE

/*****************************/
/*   MACROS                  */
/*****************************/


/*
#define GET_SIG_DEV(code1, code2) (psignal->chan == SIGNAL1) ? (code1) : (code2)
*/

/*****************************/
/*   FUNCTION PROTOTYPES     */
/*****************************/

        /* sig_time.c functions */

       void            ResetSigPathState( void );

       void            RTTSetSignal1Type( INT32 Type );
       void            RTTSetSignal2Type( INT32 type );
       void            RTTSetSignal1Zero( INT32 zero );
       void            RTTSetSignal2Zero( INT32 zero );
       void            RTTSetSignal1Range( INT32 range );
       void            RTTSetSignal2Range( INT32 range );
       void            RTTSetSignal1Attn( INT32 attn );
       void            RTTSetSignal2Attn( INT32 attn );
       void            RTTStoreSignal1Value( INT32 unused );
       void            RTTStoreSignal2Value( INT32 unused );
       void            RTTSignal1ZeroLessVal( INT32 unused );
       void            RTTSignal2ZeroLessVal( INT32 unused );
       void            RTTFreezeSignal1( INT32 unused );
       void            RTTFreezeSignal2( INT32 unused );
       void            RTTResumeSignal1( INT32 unused );
       void            RTTResumeSignal2( INT32 unused );

        /* scc_ui.c functions */

        SCC_COLLECT_STATE GetSccCollectState( pCCOMP_TABLE pccomp );
        POSITION          GetSccDataDetector( pCCOMP_TABLE pccomp );
        DET_TYPE          GetSccDetectorType( pCCOMP_TABLE pccomp );
        POSITION          GetSccSignalType( pCCOMP_TABLE pccomp );
        SCC_DATA_STATE    GetSccDataState( pCCOMP_TABLE pccomp );
        DATETIME          GetSccDataDateTime (pCCOMP_TABLE pccomp );
        INT32             GetSccDataDate (pCCOMP_TABLE pccomp );
        INT32             GetSccDataTime (pCCOMP_TABLE pccomp );

        UI_ERR            SetSccSignalType( pCCOMP_TABLE pccomp,
                                            POSITION position );
        UI_ERR            CheckSccSignalType( pCCOMP_TABLE pccomp,
                                            POSITION position );

        /* sig_type.c functions */


        UI_ERR SetSignalTypeMain ( pSIG_TABLE psignal, SIG_TYPE type,
                                   BIT8 set_wkfile_flag );

        UI_ERR          SetSignalType( pSIG_TABLE psignal, SIG_TYPE type );

        void            DetOnOffChanged( void );

        SCALE_CONSTANTS const *GetSignalScaleFactor( SIG_TYPE type );
        INT16           GetAlternateSignalIndex( SIG_TYPE type );

        /* Diagnostic functions */

        INT32           GetPresSignalValue( SIG_TYPE type );
        INT32           GetAlternateSignalValue( SIG_TYPE type );
        UI_ERR          SetSignalTypeForDiagnostics( pSIG_TABLE psignal,
                                                     SIG_TYPE type );

        /* sig_ui.c functions */

        UI_ERR         SetSignalAttn( pSIG_TABLE psignal, INT32 attn );
        UI_ERR         SetSignalRange( pSIG_TABLE psignal, INT32 range );
        UI_ERR         SetDisplaySignalZero( pSIG_TABLE psignal, INT32 zero );
        UI_ERR         SetSignalZero( pSIG_TABLE psignal, INT32 zero );
        UI_ERR         SetSignalZeroOn( pSIG_TABLE psignal );
        UI_ERR         SetSignalZeroOff( pSIG_TABLE psignal );
        UI_ERR         SetSignalDataRate( pSIG_TABLE psignal, RATE_TYPE rate );
        UI_ERR         SetAttnOnOff( pSIG_TABLE psignal, ON_OFF on_off );
        UI_ERR         SetFastPeaks( pSIG_TABLE psignal, BIT32 rate );


        UI_ERR         CheckSignalType( SIG_TYPE type );
        UI_ERR         CheckSignalZero ( INT32 zero );
        UI_ERR         CheckScaledSignalZero ( INT32 zero );
        UI_ERR         CheckDisplaySignalZero( pSIG_TABLE psignal, INT32 zero );
        UI_ERR         CheckSignalRange ( INT32 range );
        UI_ERR         CheckSignalAttn( INT32 attn );
        UI_ERR         CheckSignalDataRate( RATE_TYPE rate );
        UI_ERR         CheckFastPeaks( BIT32 rate );


        SIG_UNITS      GetSignalUnits( pSIG_TABLE psignal );
        INT32          GetSignalType( pSIG_TABLE psignal );
        INT32          GetSignalAttn( pSIG_TABLE psignal );
        INT32          GetSignalRange( pSIG_TABLE psignal );
        INT32          GetDisplayedSignalZero( pSIG_TABLE psignal );
        U_INT16        GetSignalZeroMsg( pSIG_TABLE psignal );
        INT32          GetSignalZero( pSIG_TABLE psignal );
        INT32          GetDisplayedSignalValue( pSIG_TABLE psignal );
        U_INT16        GetSignalValueMsg( pSIG_TABLE psignal );
        INT32          GetSignalValue( pSIG_TABLE psignal );
        ON_OFF         GetSignalZeroOnOff( pSIG_TABLE psignal );
        RATE_TYPE      GetSignalDataRate( pSIG_TABLE psignal );
        ON_OFF         GetAttnOnOff( pSIG_TABLE psignal );
        BIT32          GetFastPeaks( pSIG_TABLE psignal );

        INT32          GetSignalScaleMultiplier( pSIG_TABLE psignal );
        INT32          GetSignalScaleDivisor( pSIG_TABLE psignal );
        SIG_UNITS      GetSignalUnits( pSIG_TABLE psignal );
        SIG_UNITS      GetSignalUnitsFromType( SIG_TYPE type );
        INT32          GetSignalScaleLabel( pSIG_TABLE psignal );

        BIT8           ScaledSignal( pSIG_TABLE psignal );
        BIT8           UnscaledSignal( SIG_TYPE type );
        BIT8           AlternateSignal( SIG_TYPE type );

        /* Diagnostic functions */

        INT32          GetSignalNoise( pSIG_TABLE psignal );

        /* sig_mem.c functions */

        UI_ERR         CheckWritableMemLoc( U_INT32 *pmem, DATA_SIZE size );
        UI_ERR         SetSignalMemLoc( pSIG_TABLE psignal,
                                        DATA_SIZE size, U_INT32 *pmem );
        UI_ERR         CheckSignalMemLoc( U_INT32 *pmem, DATA_SIZE size );
        INT32          GetSignalMemLocAddr( pSIG_TABLE psignal );
        DATA_SIZE      GetSignalMemLocSize( pSIG_TABLE psignal );
        UI_ERR         GetDataSize( INT32 value, DATA_SIZE *size );

        /* sx_cmds.c functions */
        U_INT32        GetDataRate(pSIG_TABLE  p_signal);

#pragma SECTION PROG=rom3

        /* r_signal.c functions */

        pSIG_TABLE     WhatSignal (void);
        pSIG_TABLE     LineWhatSignal (LINE line);

        /* keyboard/kbd_util.c functions */
       U_INT16        GetSignalTypeMsg( pSIG_TABLE psignal );
       U_INT32        GetSccSignalTypeMsg( pCCOMP_TABLE pccomp );

#pragma SECTION UNDO

#endif
